{php echo register_jssdk();}
{template 'common/header'}
<!-- <title>{php echo $this->set['texts']['become']}</title> -->
<title>领取礼品</title>
<style type="text/css">
body {margin:0; font-family:'微软雅黑';}
.top {overflow:hidden}
.top img { width:100%;}
a{ text-decoration: none;}
.main {height:520px; padding:30px 12px;}
.main .text {height:20px; font-size:14px; line-height:20px; color:#666;}
.main .text span {color:#f6914b;}

.main .text1 {padding:5px; font-size:14px; line-height:20px; color:#666;}
.main .text1 span {color:#f6914b;}


.main .input {height:36px; margin:14px 10px 0 0;background:#fff;border-radius:5px;}
.main .input input {width:100%;  height:36px; border:0px; outline:none; font-size:15px; color:#999;}

.main .sub {height:40px; background:#e53c39; margin-top:14px; border-radius:5px; text-align:center; line-height:40px; color:#fff; font-size:16px;}
.main .title {height:30px; margin-top:20px; font-size:12px; line-height:30px; color:#666;}
.vip_main {height:182px; background:#fff; border-radius:4px;}  
.vip_main .vip {height:36px; padding:12px; border-bottom:1px solid #f1f1f1; overflow:hidden; font-size:12px; color:#999;}
.vip_main .vip .ico1 {height:36px; width:36px; background:#32cd32; border-radius:18px; color:#fff; font-size:20px; line-height:36px; text-align:center; float:left;}
.vip_main .vip .ico2 {height:36px; width:36px; background:#fece00; border-radius:18px; color:#fff; font-size:22px; line-height:40px; text-align:center; float:left;}
.vip_main .vip .text {height:36px; margin-left:12px; float:left;}
.vip_main .vip .text .t1 {height:18px; font-size:15px; color:#666; line-height:18px;}
.vip_main .vip .text .t2 {height:18px; font-size:13px; color:#999; line-height:18px;}


.ok {height:200px;}
.ok .ico {height:65px; width:65px; margin:auto; border:3px solid #32cd32; border-radius:55px; color:#32cd32; font-size:50px; text-align:center; line-height:65px;}
.ok .text {height:20px; margin-top:30px; font-size:16px; color:#666; line-height:20px; text-align:center;}
.ok .sub {height:32px; width:145px; background:#e53c39; margin:20px auto; border-radius:20px; color:#fff; line-height:32px; text-align:center; font-size:16px;}
#myModal{top:10%;}
#cover{display:none;position:absolute;left:0;top:0;z-index:18888;background-color:#000000;opacity:0.7;}
#guide{display:none;position:absolute;right:18px;top:5px;z-index:19999;}
#guide img{width:260px;height:180px;}
</style>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script>
        wx.ready(function () {
        shareData = {
            'title' : "{$style['sharetitle']}",
            'desc': "{$style['sharedesc']}",
            'link': "http://wx.lanxuevip.com/app/index.php?i=5&c=entry&do=gift&m=ewei_shop&xiaodian={$_GPC['xiaodian']}&log_id={$_GPC['log_id']}",
            'imgUrl': "{php echo tomedia($style['image']);}",
        };
        //分享朋友
    wx.onMenuShareAppMessage({
        title: shareData.title,
        desc: shareData.desc,
        link: shareData.link,
        imgUrl:shareData.imgUrl,
        trigger: function (res) {
        },
        success: function (res) {
        	window.location.href =adurl;
        },
        cancel: function (res) {
            alert('分享是一种美德哦！');
        },
        fail: function (res) {
            alert(JSON.stringify(res));
        }
    });
//朋友圈
    wx.onMenuShareTimeline({
        title: shareData.title,
        link: shareData.link,
        imgUrl:shareData.imgUrl,
        trigger: function (res) {
        },
        success: function (res) {
            window.location.href =adurl;
        },
        cancel: function (res) {
            alert('分享是一种美德哦！');
        },
        fail: function (res) {
            alert(JSON.stringify(res));
        }
        });
    });
    </script>
        <style type="text/css">
        body{ background:{$style['color']};}
         </style>
        <div id='container'></div>
        <div class="ok">
                  <div style="height:150px;width:100%;text-align: center;font-size: 24px;background:url('../addons/ewei_shop/static/images/gift/tou.png');-moz-background-size:100% 100%;background-size:100% 100%;background-repeat:no-repeat;">
                                <div style="height:90px;width:70%;margin:auto;padding-top:30px;">  
                                        <div style="line-height:90px;color:#E9A92F;font-size:40px;text-align: center;background:url('../addons/ewei_shop/static/images/gift/money.png');-moz-background-size:100% 100%;background-size:100% 100%;background-repeat:no-repeat;height:90px;width:70%;float:left;">
                                        {$row['money']}元
                                        </div>
                                        <div style="background:url('../addons/ewei_shop/static/images/gift/biaozhu.png');-moz-background-size:100% 100%;background-size:100% 100%;background-repeat:no-repeat;height:90px;width:30%;float:right;">
                                         <div style="margin-top:10px;font-size:10px;">
                                             <b>点击下方按钮<br/>
                                             {if $_GPC['xiaodian'] == $mid}    
                                                 分享礼品
                                             {else}
                                                 领取礼品
                                             {/if}
                                             </b>
                                         </div>
                                         <div style="margin-top:10px;"><img src="../addons/ewei_shop/static/images/gift/jiantou.png"></div>
                                        </div>
                                 </div>   
                  </div>
            <div style="color:#EBAF3D;height:30px;width:100%;margin-top:10px;padding-left:30px;">赠送人：{$row['givename']}</div>
            <div style="height:60px;width:80%;margin:auto;color:#EBAF3D;">祝福语：{$row['desc']}</div>
            <div style="height:200px;width:100%;background:url('http://oss-cn-shenzhen.aliyuncs.com/weixin-lanxue/{$style['image']}');-moz-background-size:100% 100%;background-size:100% 100%;background-repeat:no-repeat;;">
            </div>
            <div id="have" style="display:none;height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
               已领取
            </div>
            {if time() < $style['endtime']}
                {if $_GPC['xiaodian'] == $mid && $row['status'] =="0"}
                <div onclick="_system._guide(true)" style="height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
                    点击分享
                </div>
                {/if}
                {if $_GPC['xiaodian'] != $mid && $row['status'] =="0"}
                <div id="give_gift" gift_id="{$_GPC['log_id']}" style="height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
                   领取礼品
                </div>
                {/if}
                {if $row['status'] =="1"}
                <div style="height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
                   已领取
                </div>
                {/if}
                {if $row['status'] =="2"}
                <div style="height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
                   已退回
                </div>
                {/if}
            {else}
                <div style="height:30px;width:150px;border-radius:10px;margin:auto;background:#EAB96D;text-align:center;color:#DD4037;line-height:30px;">
                   活动已过期！！
                </div>
            {/if}
            <div style="height:20px;width:100%;text-align: center;color:#EBAF3D;margin-top:10px;">限小妖家商城以及小店使用</div>
            <div style="height:20px;width:100%;text-align: center;color:#EBAF3D;">有效期：{$style['overtime']}</div>
        </div>
        <div id="cover"></div>
        <div id="guide">
            <img src="../addons/ewei_shop/static/images/gift/guide1.png">
        </div>
{if $gzxx !== 1}
<div class="modal fade in" id="myModal" tabindex="1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" aria-hidden="false" style="text-align:center;display:block;">
    <img src="/app/resource/images/guanzhu.png" style="width:80%;border-radius:10px;position:relative;"/>
</div>
<div class="modal-backdrop fade in"></div>
{/if}
<script type="text/javascript">
$('#give_gift').click(function(){
  var id=$('#give_gift').attr('gift_id');
  $.post("/app/index.php?i=5&c=entry&do=gift&m=ewei_shop",{'id':id},function(result){
   alert('领取成功！');
   $('#give_gift').hide();
   $('#have').show();
  });    
});
</script>
<script type="text/javascript">
    var _system={
        $:function(id){return document.getElementById(id);},
   _client:function(){
      return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight,bw:document.documentElement.clientWidth,bh:document.documentElement.clientHeight};
   },
   _scroll:function(){
      return {x:document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft,y:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop};
   },
   _cover:function(show){
      if(show){
     this.$("cover").style.display="block";
     this.$("cover").style.width=(this._client().bw>this._client().w?this._client().bw:this._client().w)+"px";
     this.$("cover").style.height=(this._client().bh>this._client().h?this._client().bh:this._client().h)+"px";
  }else{
     this.$("cover").style.display="none";
  }
   },
   _guide:function(click){
      this._cover(true);
      this.$("guide").style.display="block";
      this.$("guide").style.top=(_system._scroll().y+5)+"px";
      window.onresize=function(){_system._cover(true);_system.$("guide").style.top=(_system._scroll().y+5)+"px";};
  if(click){_system.$("cover").onclick=function(){
         _system._cover();
         _system.$("guide").style.display="none";
 _system.$("cover").onclick=null;
 window.onresize=null;
  };}
   },
   _zero:function(n){
      return n<0?0:n;
   }
}
</script>
{template 'common/footer'}